package com.yf.ability.upload.providers.oss.controller;


import com.yf.ability.upload.providers.oss.dto.OssTokenDTO;
import com.yf.base.api.api.ApiRest;
import com.yf.base.api.api.controller.BaseController;
import com.yf.ability.upload.providers.oss.service.OssService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 获取OSS文件上传令牌
 *
 * @author bool
 */
@Log4j2
@Api(tags = {"OSS文件上传"})
@RestController
public class OssController extends BaseController {

    @Autowired
    private OssService ossService;

    /**
     * 获取临时上传信息
     * @return
     */
    @PostMapping("/api/common/oss/token")
    @ApiOperation(value = "获得OSS上传token")
    public ApiRest<OssTokenDTO> token() {

        OssTokenDTO respDTO = ossService.token();
        return super.success(respDTO);
    }
}
